package com.nikkerball.apps.darkhorse.model.security;

import com.nikkerball.apps.darkhorse.model.base.Person;

import java.util.ArrayList;
import java.util.List;

/**
 * The Security Context for a User
 *
 * @author marius (created on 2010-12-05)
 */
public class SecurityContext {

    // ----- instance fields -----

    private Person person;

    private List<Role> roles;

    // ----- constructors -----

    public SecurityContext(Person person) {
        this.person = person;
    }

    // ----- public methods -----

    public void addRole(Role role) {
        if (null == getRoles()) {
            setRoles(new ArrayList<Role>());
        }
        getRoles().add(role);
    }

    public Person getPerson() {
        return this.person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    public List<Role> getRoles() {
        return this.roles;
    }

    public void setRoles(List<Role> roles) {
        this.roles = roles;
    }
}
